class Move < ActiveRecord::Base
  belongs_to :board
  validate :check_with_board
  
private
  
  def check_with_board
    if @new_record
      board.update_with_moves
      board.mark(location)
    end
  rescue BoardError => m
    errors.add(:board_id, m.to_s)
  end
  
end
